package com.example.view_impl;

import android.content.Intent;

import com.example.view_impl.fragment.DIYView001Fragment;
import com.example.view_impl.fragment.DIYView002Fragment;
import com.example.view_impl.fragment.DIYView003Fragment;
import com.example.view_impl.fragment.DIYView004Fragment;
import com.example.view_impl.fragment.ViewCoordinateFragment;
import com.example.view_impl.fragment.ViewEventHandle01Fragment;
import com.example.view_impl.popup_window.PopupWindowTestActivity;
import com.zy.activity.BaseMenuActivity;
import com.zy.activity.bean.BaseBean;

import java.util.List;

public class ViewTestMenuActivity extends BaseMenuActivity {


    @Override
    protected void init(List<BaseBean> list) {
        list.add(new BaseBean("View体系"));
        list.add(new BaseBean("View工作原理"));
        list.add(new BaseBean("View事件体系"));
        list.add(new BaseBean("View的坐标体系", ViewCoordinateFragment.class));
        list.add(new BaseBean("View的事件分发(ScrollView )", ViewEventHandle01Fragment.class));

        list.add(new BaseBean("自定义View"));
        list.add(new BaseBean("Canvas绘制001(基础)", DIYView001Fragment.class));
        list.add(new BaseBean("Canvas绘制002(空心)", DIYView002Fragment.class));
        list.add(new BaseBean("Canvas绘制003(表格)", DIYView003Fragment.class));
        list.add(new BaseBean("Canvas绘制003(拖动)", DIYView004Fragment.class));

        list.add(new BaseBean("PopupWindow"));
        list.add(new BaseBean("PopupWindow", 20));

        //clickItem(new BaseBean("Canvas绘制", DIYView001Fragment.class));
        //clickItem(new BaseBean("Canvas绘制", DIYView002Fragment.class));
        //clickItem(new BaseBean("Canvas绘制", DIYView003Fragment.class));
        clickItem(new BaseBean("Canvas绘制", DIYView004Fragment.class));
    }

    @Override
    protected void clickItem(BaseBean bean) {
        if (bean == null) {
            return;
        }
        if (bean.getCode() == 20) {
            startActivity(new Intent(this, PopupWindowTestActivity.class));
        } else {
            Intent intent = new Intent(this, ViewTestMainActivity.class);
            intent.putExtra("code", bean.getCode());
            intent.putExtra("targetClass", bean.getTargetClass());
            startActivity(intent);
        }
    }
}